package com.baizhi.service;

import com.baizhi.dao.LessonDao;
import com.baizhi.entrty.Lesson;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class LessonServiceImpl implements LessonService {
    @Autowired
    private LessonDao ld;
    @Override
    public Map fy(int page, int rows) {
        int count = ld.getCount();
        int start = (page-1)*rows;

        List<Lesson> list = ld.getLesson(start,rows);
        Map map = new HashMap();
        map.put("total",count);
        map.put("rows",list);
        return map;
    }

    @Override
    public void insert(Lesson lesson) {

        ld.insert(lesson);
    }

    @Override
    public void delete(int[] id) {
        ld.delete(id);
    }
}
